package ar.com.spsolutions.splilabrary.view.components.modalwindow;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.Panel;

public abstract class SelectContentPanel extends Panel {

	private static final long serialVersionUID = 8037845824847482454L;

	public SelectContentPanel(final String id) {
		super(id);

		// Create the form, to use later for the buttons
		final Form<Void> form = new Form<Void>("form");
		this.add(form);

		// add(new AjaxLink("selectionLink") {
		// private static final long serialVersionUID = -5075360465687613407L;
		//
		// @Override
		// public void onClick(final AjaxRequestTarget target) {
		// onSelect(target, new String("Selected something using the link."));
		// }
		// });

		// form.add(new AjaxButton("selectionButton") {
		// private static final long serialVersionUID = -7272777013837145437L;
		//
		// @Override
		// protected void onSubmit(final AjaxRequestTarget target, final Form<?>
		// form) {
		// onSelect(target, new String("Selected something using the button."));
		// }
		//
		// @Override
		// protected void onError(final AjaxRequestTarget target, final Form<?>
		// form) {
		// // .
		// }
		// });

		// Add a cancel / close button.
		form.add(new AjaxLink<Void>("close") {

			private static final long serialVersionUID = -4772777570796020495L;

			@Override
			public void onClick(final AjaxRequestTarget target) {
				SelectContentPanel.this.onCancel(target);
				// this.setResponsePage(Home.class);
			}

		});

	}

	public abstract void onCancel(AjaxRequestTarget target);

	public abstract void onSelect(AjaxRequestTarget target, String selection);

}
